Component({
  options: {
    multipleSlots: true
  },
  properties: {
    name: { //标题名称
      type: String,
      value: ''
    },
    showBorder: { //是否显示border
      type: [Boolean, String],
      value: false
    },
    color: { //标题颜色
      type: String,
      value: '#333'
    },
    size: { //标题字体大小
      type: [String, Number],
      value: '14'
    },
    bgColor: { //标题名称
      type: String,
      value: '#fff'
    },
    text: { //右侧文本
      type: String,
      value: ''
    },
    textColor: { //右侧文本颜色
      type: String,
      value: '#999'
    },
    textSize: { //右侧文本字体大小
      type: [String, Number],
      value: 13
    },
    imgUrl: { //图标/图片路径
      type: String,
      value: ''
    },
    imgSize: { //图标尺寸
      type: [String, Number],
      value: 20
    },
    url: { //跳转链接
      type: String,
      value: ''
    },
    navigateTo: { //跳转方式
      type: String,
      value: ''
    }
  },
  data: {

  },
  methods: {
    bindAction: function () {
      if (this.data.url) {
        switch (this.data.navigateTo) {
          case 'redirectTo':
            wx.redirectTo({
              url: this.data.url
            });
            break;
          case 'switchTab':
            wx.switchTab({
              url: this.data.url
            });
            break;
          case 'reLaunch':
            wx.reLaunch({
              url: this.data.url
            });
            break;
          default:
            wx.navigateTo({
              url: this.data.url
            });
        }
      } else {
        this.triggerEvent('action')
      }
    }
  }
})
